<extend name="Public/baseConf" />
<block name="breadcrumb"> 
	<div class="row wrapper border-bottom white-bg page-heading">
	    <div class="col-lg-8">
	        <h2>新增模型</h2>
	        <ol class="breadcrumb">
	            <li><a href="{:U('index/index')}">首页</a></li>
	            <li><a href="{:U('Model/index')}">模型列表</a></li>
	            <li class="active">
	                <strong>新增模型</strong>
	            </li>
	        </ol>
	    </div>
	    <div class="col-lg-4">
            <div class="title-action">
 				<button class="btn btn-primary ajax-post" type="submit" target-form="form-horizontal"><i class="fa fa-check"></i>保存</button>
	            <a class="btn btn-warning" type="submit" href="{:U('index')}"><i class="fa fa-reply"></i>返回</a>
            </div>
        </div>
	</div>  
</block>
<block name="body">
<div class="page-content">
	<div class="row">
	    <div class="col-lg-12">
	        <div class="ibox float-e-margins">
	            <div class="ibox-title">
	                <h5>请在下表中填入信息<small></small></h5>
	                <div class="ibox-tools">
	                    <a class="collapse-link">
	                        <i class="fa fa-chevron-up"></i>
	                    </a>
	                </div>
	            </div>
	            <div class="ibox-content">
	                <form id="form" action="{:U('update')}" method="post" class="form-horizontal doc-modal-form">
	                    <div class="form-group"><label class="col-sm-4 control-label">序号</label>
	                        <div class="col-sm-8"><input type="text" id="serialnumber" name="serialnumber" placeholder="必填项"
					value="{$data.serialnumber}"  class="form-control"></div>
	                    </div>
	                    <div class="hr-line-dashed"></div>
	                    <div class="form-group"><label class="col-sm-4 control-label">模型标识<small>（请输入文档模型标识）</small></label>
	                        <div class="col-sm-8"><input type="text"  name="name" value="" class="form-control"></div>
	                    </div>
	                    <div class="hr-line-dashed"></div>
	                    <div class="form-group"><label class="col-sm-4 control-label">模型名称<small>（请输入模型的名称）</small></label>
	                        <div class="col-sm-8"><input type="text"  name="title" value="" class="form-control"></div>
	                    </div>
	                    <div class="hr-line-dashed"></div>
	                    <div class="form-group"><label class="col-sm-4 control-label">模型类型<small>（目前只支持独立模型和文档模型）</small></label>
	                        <div class="col-sm-8"><select name="extend"  class="form-control">
								<option value="0">独立模型</option>
								<option value="1">文档模型</option>
							</select></div>
	                    </div>
	                    <div class="hr-line-dashed"></div>
	                    <div class="form-group"><label class="col-sm-4 control-label">引擎类型</label>
	                        <div class="col-sm-8"><select name="engine_type"  class="form-control">
								<option value="MyISAM">MyISAM</option>
								<option value="InnoDB">InnoDB</option>
			                             <option value="MEMORY">MEMORY</option>
			                             <option value="BLACKHOLE">BLACKHOLE</option>
			                             <option value="MRG_MYISAM">MRG_MYISAM</option>
			                             <option value="ARCHIVE">ARCHIVE</option>
							</select></div>
	                    </div>
	                    <div class="hr-line-dashed"></div>
	                    <div class="form-group"><label class="col-sm-4 control-label">是否需要主键<small>（选“是”则会新建默认的id字段作为主键）</small></label>
	                        <div class="col-sm-8"><select name="need_pk" class="form-control">
								<option value="1" selected="selected">是</option>
								<option value="0">否</option>
							</select></div>
	                    </div>
	                    <div class="hr-line-dashed"></div>
 
	                </form>
	            </div>
	        </div>
	    </div>
	</div> 
	</form>
 
</div>
</block>
<block name="script">
<script type="text/javascript" src="__STATIC__/jquery.dragsort-0.5.1.min.js"></script>
<script type="text/javascript" charset="utf-8">
    //导航高亮
    highlight_subnav('{:U('Model/index')}');

    $(function(){
    	showTab();
    })
	//拖曳插件初始化
	$(function(){
		$(".dragsort").dragsort({
		     dragSelector:'li',
		     placeHolderTemplate: '<li class="draging-place">&nbsp;</li>',
		     dragBetween:true,	//允许拖动到任意地方
		     dragEnd:function(){
		     	updateVal();
		     }
		 });
	
		$('#sortUl li b').click(function(){
			$(this).parent().remove();
			updateVal();
		});
	
		// 更新排序后的隐藏域的值
		function updateVal() {
			var sortVal = [];
			var i = 1;
			var val = '';
		   	$('#base li').each(function(){
		   		sortVal[i++] = $(this).find('em').text();
		   	});
		   	i = -1;
		   	$('#extend li').each(function(){
		   		sortVal[i--] = $(this).find('em').text();
		   	});
		   	//将排序数组拼接成json格式字符串
		   	val += "[";
		   	for (k in sortVal){
		   		val += "\"" + sortVal[k] + "\"" + ":" + k + ",";
		   	}
		   	val = val.substr(0,val.length - 1) + "]";
		    $("input[name='fields']").val(val);
		}
	})
</script>
</block>

